import moduleRegist from '@/utils/moduleRegist';
// import { module as paypayerModule } from './module';
import { module as paypayerModule } from './Module/payChahel';
import { module as payOrderModule } from './Module/payOrder';
import { module as refundOrderModule } from './Module/refundOrder';
import QrFlow from './QrFlow/routes';
// import { module as taxpayerItemsModule } from '../taxpayerItems/module';

const Layout = resolve => { require(['./Layout'], resolve); };

const PayChannel = resolve => { require(['./PayChannel'], resolve); };

const PayOrder = resolve => { require(['./PayOrder'], resolve); };
const PayOrderDetele = resolve => { require(['./PayOrderDetele'], resolve); };

const RefundOrder = resolve => { require(['./RefundOrder'], resolve); };

const RefundDetailForm = resolve => { require(['./RefundDetailForm'], resolve); };

export default [
  /** 配置管理路由 */
  {
    path: 'payCenter',
    redirect: 'payCenter/payOrder',
    component: Layout,
    meta: {
      title: '支付中心',
      name: '支付中心',
      permission: 'trade:payment',
      componentName: 'PaypayerLayout',
      keepAlive: true,
      icon: '',
      show: false
    },
    beforeEnter: (to, from, next) => {
      moduleRegist(paypayerModule);
      moduleRegist(payOrderModule);
      moduleRegist(refundOrderModule);
      // moduleRegist(taxpayerItemsModule);
      next();
    },
    children: [
      {
        path: 'payOrder',
        component: PayOrder,
        meta: {
          title: '渠道支付订单查询',
          name: '渠道支付订单查询',
          breadcrumb: '渠道支付订单查询',
          permission: 'trade:payment:payOrder',
          show: true,
          keepAlive: true,
          componentName: 'PaypayerAddView',
          icon: 'md-people'
        }
      },
      {
        path: 'payOrderDetele',
        component: PayOrderDetele,
        meta: {
          title: '渠道支付订单详情',
          name: '渠道支付订单详情',
          breadcrumb: '渠道支付订单详情',
          permission: 'trade:payment:payOrder',
          show: false,
          keepAlive: true,
          componentName: 'PaypayerAddView',
          icon: 'md-people'
        }
      },
      {
        path: 'refundOrder',
        component: RefundOrder,
        meta: {
          title: '渠道退款订单查询',
          name: '渠道退款订单查询',
          breadcrumb: '渠道退款订单查询',
          permission: 'trade:payment:refundOrder',
          show: true,
          keepAlive: true,
          componentName: 'PaypayerAddView',
          icon: 'md-people'
        }
      },
      {
        path: 'payChannel',
        component: PayChannel,
        meta: {
          title: '支付渠道管理',
          name: '支付渠道管理',
          breadcrumb: '支付渠道管理',
          permission: 'trade:payment:payChannel',
          keepAlive: true,
          componentName: 'PaypayerListView',
          icon: ''
        }
      },
      // {
      //   path: 'payDetailForm',
      //   component: PayDetailForm,
      //   meta: {
      //     title: '支付流水详情',
      //     name: '支付流水详情',
      //     breadcrumb: '支付流水详情',
      //     permission: 'trade:payment:manager',
      //     show: true,
      //     keepAlive: true,
      //     componentName: 'PaypayerAddView',
      //     icon: 'md-people'
      //   }
      // },
      {
        path: 'refundDetailForm',
        component: RefundDetailForm,
        meta: {
          title: '渠道退款订单详情',
          name: '渠道退款订单详情',
          breadcrumb: '渠道退款订单详情',
          permission: 'trade:payment:refundDetailForm',
          show: false,
          keepAlive: true,
          componentName: 'PaypayerAddView',
          icon: 'md-people'
        }
      },
      ...QrFlow
    ]
  }
];
